package com.jingdianjichi.subject.convert;

import com.jingdianjichi.subject.entity.SubjectCategoryBO;
import com.jingdianjichi.subject.entity.SubjectInfoBO;
import com.jingdianjichi.subject.entity.SubjectOptionBO;
import com.jingdianjichi.subject.infra.basic.entity.SubjectCategory;
import com.jingdianjichi.subject.infra.basic.entity.SubjectInfo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface SubjectInfoConverter {
    SubjectInfoConverter Instatnce= Mappers.getMapper(SubjectInfoConverter.class);

    SubjectInfo convertBOToEntity(SubjectInfoBO subjectInfoBO);

    List<SubjectInfoBO> convertEntityToBO(List<SubjectInfo> subjectInfoList);

    @Mappings({
            @Mapping(source = "subjectInfoBO.pageNo", target = "pageNo"),
            @Mapping(source = "subjectInfoBO.pageSize", target = "pageSize"),
            @Mapping(source = "subjectOptionBO.subjectAnswer", target = "subjectAnswer"),
            @Mapping(source = "subjectOptionBO.optionList", target = "optionList")
    })
    SubjectInfoBO convertBOAndOptionToBO(SubjectOptionBO subjectOptionBO, SubjectInfoBO subjectInfoBO);
}
